import {
  atom,
  selector,
} from 'recoil';

// 單個對話 当前AI
const currentAiChat = atom({
  key: 'currentAiChat', 
  default: {id:0},
});

const currentAiChatState = selector({
  key: 'currentAiChatState',
  get: ({get}) => {
    const text = get(currentAiChat);
    return text;
  },
});


// 全部AI对话列表
const chatList = atom({
  key: 'chatList', 
  default: {1:{},2:{}},
});

const chatListState = selector({
  key: 'chatListState',
  get: ({get}) => {
    const text = get(chatList);
    return text;
  },
});

// 全部AI列表
const robotList = atom({
  key: 'robotList', 
  default: [],
});

const robotListState = selector({
  key: 'robotListState',
  get: ({get}) => {
    const text = get(robotList);
    return text;
  },
});


// 设置信息
const settingInfo = atom({
  key: 'settingInfo', 
  default: {
    "index_robot_id": 1,
    "together": 2,
    "together_ids": "1,2"
  },
});

const settingInfoState = selector({
  key: 'settingInfoState',
  get: ({get}) => {
    const text = get(settingInfo);
    return text;
  },
});


export {
  currentAiChat,
  currentAiChatState,
  chatList,
  chatListState,
  robotList,
  robotListState,
  settingInfo,
  settingInfoState
}